﻿using System.Windows;
using System.Windows.Controls;
using KharaPos.Web.Entities;

namespace KharaPos.Views.Catalog
{
    public partial class AddCategoryWindow : ChildWindow
    {
        public AddCategoryWindow()
        {
            InitializeComponent();
            NewCategory = new Category() {Name = "foobar"};
            NewCategoryDataForm.CurrentItem = NewCategory;
            NewCategoryDataForm.BeginEdit();
        }

        public Category NewCategory { get; set; }

        private void OkButtonClick(object sender, RoutedEventArgs e)
        {
            NewCategoryDataForm.CommitEdit();
            DialogResult = true;
        }

        private void CancelButtonClick(object sender, RoutedEventArgs e)
        {
            NewCategory = null;
            NewCategoryDataForm.CancelEdit();
            DialogResult = false;
        }
    }
}

